/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pruefung.ss11;

import java.util.*;

/**
 *
 * @author Fabian Heidorn, Alexander Kaack
 */
public class Aufgaben {
    
    public static void main(String[] args) {
        System.out.println(makeStringList(10));
        System.out.println(makeIntList(2));
        System.out.println(flatten(makeStringList(10)));
    }
    
    public static List<List<List<String>>> makeStringList(int m) {
        List<List<List<String>>> result = new ArrayList<List<List<String>>>();
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < m; k++) {
                    List<List<String>> tier2 = new ArrayList<List<String>>();
                    List<String> tier3 = new ArrayList<String>();
                    tier3.add("i: " + i + "j: " + j + "k: " + k);
                    tier2.add(tier3);
                    result.add(tier2);                    
                }
            }      
        }
        return result;
    }
    
    public static List<String> flatten(List<List<List<String>>> list){
        List<String> result = new ArrayList<String>();
      
        for (List<List<String>> olist : list) {
            for (List<String> ilist1 : olist) {
                for (String ilist2 : ilist1) {
                    result.add(ilist2);
                }
            }
        }
        return result;
    }
    
    public static List<List<List<Integer>>> makeIntList(int m) {
        List<List<List<Integer>>> result = new ArrayList<List<List<Integer>>>();
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < m; j++) {
                for (int k = 0; k < m; k++) {
                    List<List<Integer>> tier2 = new ArrayList<List<Integer>>();
                    List<Integer> tier3 = new ArrayList<Integer>();
                    tier3.add(i*j);
                    tier2.add(tier3);
                    result.add(tier2);                    
                }
            }      
        }
        return result;
    }
}